package com.yangquan.ayuan.threadState;

import java.util.concurrent.TimeUnit;

public class ThreadState {
    public static void main(String[] args) throws Exception {
        ThreadStateExample example = new ThreadStateExample();
         // 可以调用线程的setName()方法，给线程取一个名字
        example.setName("custom-thread");
        example.start();
    }
}

class ThreadStateExample extends Thread {
    @Override
    public void run() {
        System.out.println("线程启动成功");
        try {
            TimeUnit.MINUTES.sleep(10);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}